package bb.lanxing.utils;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;


import bb.lanxing.App;
import bb.lanxing.activity.base.WebActivity;
import bb.lanxing.activity.login.AccountLoginActivity;


public class IntentUtils {
    public static final String ACTION_LOCATION_SHARE = "bb.lanxing.action.LOCATION_SHARE";

    public static void gotoLoginQQ(Activity activity) {
        AccountLoginActivity.launchLoginActivity(activity, 0);
    }


    public static void gotoWebBrowser(Context context, String webUrl, String title) {
        gotoWebBrowser(context, webUrl, title, false);
    }

    public static void gotoWebBrowser(Context context, String webUrl, String title, boolean canShare) {
        Intent intent = new Intent(context, WebActivity.class);
        intent.putExtra("web_url", webUrl);
        intent.putExtra("title", title);
        intent.putExtra("can_share", canShare);
        context.startActivity(intent);
    }

    public static void gotoWebBrowserWithToken(Context context, String webUrl, String title, boolean canShare, String token) {
        Intent intent = new Intent(context, WebActivity.class);
        intent.putExtra("web_url", webUrl);
        intent.putExtra("title", title);
        intent.putExtra("can_share", canShare);
        intent.putExtra("token", token);
        context.startActivity(intent);
    }

    public static void gotoChatWebBrowser(Context context, String webUrl, String title, boolean canShare) {
        Intent intent = new Intent(context, WebActivity.class);
        intent.putExtra("web_url", webUrl);
        intent.putExtra("title", title);
        intent.putExtra("can_share", canShare);
        intent.putExtra("isNeedReport", true);
        intent.putExtra("isNoNeedShare", true);
        context.startActivity(intent);
    }

    public static void gotoWebBrowser(Context context, String webUrl, String title, boolean canShare, String proSource) {
        Intent intent = new Intent(context, WebActivity.class);
        intent.putExtra("web_url", webUrl);
        intent.putExtra("title", title);
        intent.putExtra("can_share", canShare);
        intent.putExtra("pro_source", proSource);
        context.startActivity(intent);
    }

    public static void gotoWebBrowser(Context context, String str, String str2, boolean z, boolean z2) {
        Intent intent = new Intent(context, WebActivity.class);
        intent.putExtra("web_url", str);
        intent.putExtra("title", str2);
        intent.putExtra("can_share", z);
        intent.putExtra("homeBackable", z2);
        context.startActivity(intent);
    }

    public static void gotoPermissionSetting(Context context) {
        Intent intent = new Intent();
        intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
        intent.setData(Uri.fromParts("package", App.getContext().getPackageName(), null));
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent);
    }
}
